package com.qinaxiwit.controller;


import com.qianxi.wit.pojo.TbSymptoms;
import com.qianxi.wit.result.R;
import com.qinaxiwit.service.TbCenterService;
import com.qinaxiwit.service.TbSymptomsService;
import com.qinaxiwit.service.impl.TbSymptomsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wyh
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/symptoms")
public class TbSymptomsController {

    @Autowired
    private TbSymptomsService symptomsService;

    @Autowired
    private TbCenterService centerService;

    @GetMapping("/Rapid")
    public R findSort(){
        List<TbSymptoms> list = symptomsService.findAll();
        return R.ok().data("list",list);
    }


    @PostMapping("/findSymptoms")
    public R findSymptoms(@RequestBody TbSymptoms symptoms){
        List<TbSymptoms> list = symptomsService.findSymptoms(symptoms);
        //病症表的id数组
        long[] ids=new long[10];
        for (int i=0;i<list.size();i++) {
            ids[i] = list.get(i).getSymptomsId();
        }
        Long[] all = centerService.findAll(ids);

        System.out.println(all);
        return R.ok().data("all",all);
    }

}

